package com.ihr360.insurance.dao;

import com.ihr360.commons.model.type.SIHFLedgerState;
import com.ihr360.insurance.model.dto.ledger.MonthlyLedgerSummary;
import com.ihr360.rest.reposity.SimpleRestReposity;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import java.util.List;

@RepositoryRestResource
public interface MonthlyLedgerSummaryReposity extends SimpleRestReposity<MonthlyLedgerSummary, Long>, PagingAndSortingRepository<MonthlyLedgerSummary, Long> {

    MonthlyLedgerSummary findByCompanyIdAndUserIdAndAndLedgerYearAndLedgerMonth(String companyId,
                                                                                String userId,
                                                                                Integer ledgerYear,
                                                                                Integer ledgerMonth);

    int countByCompanyIdAndUserIdAndLedgerYearAndLedgerMonthAndLedgerState(String companyId,
                                                                           String userId,
                                                                           Integer ledgerYear,
                                                                           Integer ledgerMonth,
                                                                           SIHFLedgerState state);

    int countByCompanyIdAndUserIdAndLedgerYearAndLedgerMonth(String companyId,
                                                             String userId,
                                                             Integer ledgerYear,
                                                             Integer ledgerMonth);

    List<MonthlyLedgerSummary> findByCompanyIdAndApplicationIdIn(String companyId, List<String> applicationIdList);

    MonthlyLedgerSummary findByCompanyIdAndApplicationId(String companyId,String applicationId);

}